<template>
    <div>
        <div class="searchInput">
            <div class="xia">
                <div class="kuang">
                    <div>
                        订单编号： <el-input placeholder="请输入订单编号"></el-input>&emsp;&emsp13;
                    </div>
                    <div>
                        手机号： <el-input placeholder="请输入手机号"></el-input>&emsp;&emsp13;
                    </div>
                    <div>
                        车牌号： <el-input placeholder="请输入车牌号"></el-input>&emsp;&emsp13;
                    </div>
                    <div>
                    状态： <el-select style="width: 108px;" v-model="searchState" placeholder="请选择">
                                <el-option
                                v-for="item in stateOptions"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                            </el-option>
                        </el-select>
                    </div>
            </div>
            <div class="btns">
                <el-button class="chaxun">查询</el-button>
                <el-button class="reset">重置</el-button>
            </div>
        </div><br>
    </div>
        <!-- 数据 -->
        <el-table
            :header-cell-style="{background:'#e8efff',color:'#000000'}"
            :data="lockTableData"
            :loading="loading"
            style="width: 100%">
            <el-table-column
            type="selection"
            width="55">
            </el-table-column>
            <el-table-column prop="order" label="序号" width="60">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.order }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="order_number" label="订单编号">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.order_number }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="phone_number" label="手机号">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.phone_number }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="car_number" label="车牌号">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.car_number }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="duration" label="占位时长">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                      {{ scope.row.duration }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="order_total" label="实付金额">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.order_total }}元
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="station" label="充电站">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.station }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="charge_state" label="状态">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        <span v-if="scope.row.pay_state == 0">已支付</span>
                        <span v-if="scope.row.pay_state == 1">----</span>
                        <span v-if="scope.row.pay_state == 2">待支付</span>
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="created_time" label="创建时间">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.created_time }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="address" label="操作">
                <template v-slot="scope">
                    <div class="scope" style="color:#949BBE;">
                        <span class="editBtn" @click="goWithdraw(scope.row.id)">退款</span>
                        <span class="detailBtn" @click="goDetail(scope.row.id)">详情</span>
                    </div>
                </template>
            </el-table-column>
        </el-table>
        <Pagination />
        <!-- 添加/详情/编辑 -->
        <el-dialog center :close-on-click-modal="false" width="636px" top="20vh" :visible.sync="newVisible">
            <template slot="title">
                <div class="dialog_title">
                    {{ dialogTitle }}
                </div>
            </template>
            <el-form label-position="right" :rules="rules" ref="ruleFormLock" label-width="120px" :model="gunInfoForm">
                <el-form-item prop="real_pay" label="实付金额:" >
                    <el-input v-model="gunInfoForm.real_pay" autocomplete="off" placeholder="请输入金额"></el-input>
                </el-form-item>
                <el-form-item prop="cause" label="退款原因:">
                    <el-input
                        style="width:423px ;background: #F0F1F6; outline: none;"
                        type="textarea"
                        :rows="5"
                        placeholder="请输入"
                        v-model="gunInfoForm.cause">
                    </el-input>
                </el-form-item>
                <el-form-item prop="money" label="退款金额:">
                    <el-input v-model="gunInfoForm.money" autocomplete="off" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item>
                    <span class="beiZhu">备注：退款得金额会按原路返回，中途若产生手续费需退款人承担，谢谢！</span>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button class="formCancel" @click="newVisible = false">取消</el-button>
                <el-button class="formConfirm" type="primary"  @click="submitGunForm('ruleFormLock')">提交</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import Pagination from '@/components/Pagination.vue'
    export default {
        components:{
            Pagination
        },
        data() {
            return {
                loading:true,
                disabled:false,
                searchStation:'',
                searchState:'',
                stationOptions: [
                    {
                        value: null,
                        label: '请选择'
                    }, 
                    {
                        value: 1,
                            label: '丰台科技充电站'
                            }, 
                            {
                            value: 0,
                            label: '总部基地充电站'
                            }, 
                        ],
                stateOptions: [
                    {
                    value: null,
                    label: '请选择'
                    }, 
                    {
                    value: 0,
                    label: '已支付'
                    }, 
                    {
                    value: 1,
                    label: '待支付'
                    }, 
                    {
                    value: 2,
                    label: '占位中'
                    }, 
                    {
                    value: 3,
                    label: '待处理'
                    }, 
                    {
                    value: 4,
                    label: '退款中'
                    }, 
                    {
                    value: 4,
                    label: '已退款'
                    }, 
                    ],
                    lockTableData: [
                    {
                        order: '1',
                        order_number: '20230202123',
                        phone_number: '159****3765',
                        car_number:'豫AD888888',
                        duration:'1小时30分01秒',
                        order_total:80,
                        capacity:30,
                        real_money:40,
                        station:'丰台产业园悦来电站',
                        charge_state:0,
                        pay_state:1,
                        created_time:'2023.03.03',
                        id:1
                    }
                ],
                dialogTitle:'退款申请',
                confirmBtnText:"确认",
                newVisible:false,
                newDetailVisible:false,
                gunInfoForm:{}, //充电枪信息
                is_detail:false,
                rules:{
                    real_pay: [
                        { required: true, message: '请输入实付金额', trigger: 'blur' }
                    ],
                    cause: [
                        { required: true, message: '请输入退款原因', trigger: 'blur' }
                    ],
                    money: [
                        { required: true, message: '请输入退款金额', trigger: 'blur' }
                    ]
                }
            }
        },
        methods: {
            submitGunForm(formName){
                this.$refs[formName].validate((valid) => {
                if (valid) {
                    // 验证完成
                    alert('submit!');
                    this.newVisible = false
                } else {
                    console.log('error submit!!');
                    return false;
                }
                });
            },

            changeState(){
            },
            goWithdraw(){
                this.newVisible = true
            },
            
            goDetail(id){
                this.$router.push('/chargingDetail')
            },
        },
        
    }
</script>

<style lang="less" scoped>
.searchInput{
    text-align: left;
    font-size: 14px;
    height: 25.98px;
    font-family: PingFang SC-Regular, PingFang SC;
    font-weight: 400;
    color: #666666 !important;
}
.el-input{
    width: 280px;
    height: 35.98px;
    font-size: 11.97px;
    color: #666666;
    background: #F0F1F6;
}
.el-input__inner{
  background-color: #F0F1F6;  
}
.el-select{
    width: 280px;
    height: 35.98px;
}
.kuang{
    float: left;
}

.el-button{
    background: transparent;
    border: none;
}
.chaxun{
    background: #165BFF;
    color: white;
}
.reset{
    background: #F0F1F6;
    color: #666666;
}
::v-deep .el-table th > .cell {
  text-align: center;
}

::v-deep .el-table .cell {
  text-align: center;
}
.editBtn{
    display: inline-block;
    margin-right: 8px;
    color: #000000;
    cursor: pointer;
}
.detailBtn{
    margin-right: 8px;
    display: inline-block;
    color: #165BFF;
    cursor: pointer;
}
.deleteBtn{
    display: inline-block;
    color: #FA698D;
    cursor: pointer;
}
.confirmButtonClass{
    background: #165bff;
}
#dialog .el-dialog__header {
    padding: 20px 20px 0px;
    background: #165BFF;
    text-align: left;
    font-weight: bold;
}
#dialog .el-dialog__body{
    height: 188px;
}
.formCancel,.formConfirm{
    width: 140px;
    height: 44px;
    border-radius: 4px 4px 4px 4px;
    border: none;
    opacity: 1;
}
.formCancel{
    background: white;
    border: 1px solid #F0F1F6;
}
.formConfirm{
    margin-left: 24px;
    background: #165BFF;
}
.dialog-footer{
    margin-top: -50px;
    text-align: center;
}
.el-dialog .el-input{
    width: 423px;
}
.el-dialog .el-select{
    width: 423px;
}
.dialog_title{
    margin-top: 24px;
    font-size: 16px;
    font-family: PingFang SC-Medium, PingFang SC;
    font-weight: 500;
    color: #000000;
}
.kuang>div{
    margin: 5px auto;
    display: inline-block;
}
.a .el-select{
    width: 108px;
}
.el-table{
    margin-top: 52px;
}
.xia{
    height: 50px;
}
.btns{
    float: right;
}
.btm{
    margin-top: 14px;
    margin-bottom: 32px;
}
.beiZhu{
    transform: translate(-50px,0);
    font-size: 12px;
    font-family: PingFang SC-Regular, PingFang SC;
    font-weight: 400;
    color: #999999; 
}
</style>